﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.IotInfo.LightingInfo;
using LJX.SmartPark.Domain.IotInfo.LightPoles;
using LJX.SmartPark.Service.IotInfo.LightingInfo;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.IotInfo.LightingInfo.LightingInfoServeice;

namespace LJX.SmartPark.WebApi.Controllers.IotInfo
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "IotInfo")]
    public class LightingInfoController : ControllerBase
    {
        private readonly ILightingInfoServeice _lightingInfoServeice;

        public LightingInfoController(ILightingInfoServeice lightingInfoServeice)
        {
            _lightingInfoServeice = lightingInfoServeice;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostAddLightingInfo(LightingInfo input)
        {
            var result = _lightingInfoServeice.PostAddLightingInfoAsync(input);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeleteLightingInfo(LightingInfo input)
        {
            var result = _lightingInfoServeice.DeleteLightingInfoAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateLightingInfo(LightingInfo input)
        {
            var result = _lightingInfoServeice.PutUpdLightingInfoAsync(input);

            return result;

        }

        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _lightingInfoServeice.GetCount();
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<LightingInfo>> GetLightingInfoAsync(Fen fen)
        {
            var result = _lightingInfoServeice.GetLightingInfoAsync(fen);
            return result.Result;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<LightingInfo> GetLightingInfoById(LightingInfo input)
        {
            var student = _lightingInfoServeice.GetLightingInfoById(input);
            return student;
        }
    }
}
